import os
import requests
from parsel import Selector

# 获取环境变量
def get_env(key):
    env_value = os.environ.get(key)
    if env_value:
        return env_value
    else:
        return None
# 懒汉圈入口
entry_url = get_env('LAZY_MAN_URL')

def get_html(url):
    if not url:
        raise ValueError('url is null.')
    # 获取 HTML 内容
    html_content = requests.get(url, verify=False)
    # print(html_content.text)

    selector = Selector(html_content.text)
    v = selector.css('.rich_pages::attr(data-src)')
    print(v.get())

# 开始
get_html(entry_url)